<!--  form表单搜索 -->
<form nz-form (ngSubmit)="search()" [nzLayout]="'inline'">
    <div nz-row  [nzType]="'flex'" [nzJustify]="'start'" [nzGutter]="24">
        <div nz-col [nzSpan]="8" class="mb-md">
            <div nz-form-item class="d-flex">
                <div nz-form-label><label>岗位名称</label></div>
                <div nz-form-control class="flex-1">
                    <nz-input [(ngModel)]="post.positionName" name="positionName" [nzSize]="'large'" [nzPlaceHolder]="'岗位名称'" nzId="positionName"></nz-input>
                </div>
            </div>
        </div>
        <div nz-col [nzSpan]="8" class="mb-md">
            <div nz-form-item class="d-flex">
                <div nz-form-label><label>岗位代码</label></div>
                <div nz-form-control class="flex-1">
                    <nz-input [(ngModel)]="post.positionCode" name="positionCode" [nzSize]="'large'" [nzPlaceHolder]="'岗位代码'" nzId="positionCode"></nz-input>
                </div>
            </div>
        </div>
        <div *ngIf="expandForm" nz-col [nzSpan]="8" class="mb-md">
            <div nz-form-item class="d-flex">
                <div nz-form-label><label>岗位状态</label></div>
                <div nz-form-control class="flex-1">
                    <nz-select style="width:100%" nzAllowClear [(ngModel)]="post.positionStatus"  name="positionStatus" [nzSize]="'large'" [nzPlaceHolder]="'岗位状态'" nzId="positionStatus">
                        <nz-option  *ngFor="let i of postStatus;" [nzLabel]="i.itemName" [nzValue]="i.itemValue">></nz-option>
                    </nz-select>
                </div>
            </div>
        </div>

        <div nz-col [nzSpan]="expandForm ? 24 : 8" class="mb-md" [class.text-right]="expandForm">
            <button nz-button type="submit" [nzType]="'primary'" [nzLoading]="loading" [nzSize]="'large'">查询</button>
            <button nz-button type="reset" (click)="getData()" [nzSize]="'large'" class="mx-sm">重置</button>
            <a (click)="expandForm=!expandForm">
                {{expandForm ? '收起' : '展开'}}
                <i class="anticon" [class.anticon-down]="!expandForm" [class.anticon-up]="expandForm"></i>
            </a>
        </div>
    </div>
</form>
<!-- 监听列表组件，如果点击了则告诉弹出框组件，打开弹出框,监听addCreat方法-->
<app-list (addCreat)="addHandler($event)"
          [configTitle]="configTitle"
          [total]="total"
          [selectedRows]="selectedRows"
          (buttonData)="buttonDataHandler($event)"
          (pageNumber)="monitorHandler($event)"
          (selectedRow)="selectedRow($event)"
          (deleteBatch)="deleteBatch($event)"
          (isActive)="isActive($event)"
          [initDate] = "data"
          [headerDate] = "headerData"
          [pageindex]='post.pi'
          [moreData] = "moreData"
          [loading]="loading"
          [buttons] = 'buttons'
          (buttonEvent) = "buttonEvent($event)"
></app-list>
<!--引入列表组件-->


<!--弹出框信息-->
<!--新建岗位-->
<nz-modal [nzVisible]="modalVisible" [nzMaskClosable]="false"  [nzWidth]="1024" [nzTitle]="postAddEdit"  [nzConfirmLoading]="loading" [nzContent]="modaleContent"
          [nzFooter]="modalFooter" (nzOnCancel)="canel()">
    <ng-template #modaleContent>
        <form novalidate  (ngSubmit)="save()"  #f="ngForm" >
            <div nz-row [nzType]="'flex'" [nzJustify]="'start'" [nzGutter]="24" >
                <div nz-col [nzSpan]="24" class="mb-md">
                    <div nz-form-item class="d-flex">
                        <div nz-col [nzSpan]="3"   nz-form-label class="alignment"><label for="funcCode">岗位名称</label><span [ngClass]="{'fromErrors':positionName.errors?.required}">* </span></div>
                        <div nz-col [nzSpan]="20" nz-form-control>
                            <nz-input [(ngModel)]="postAdd.positionName" name="positionName" #positionName="ngModel"  required [nzSize]="'large'" [nzPlaceHolder]="'岗位名称'" nzId="positionName"></nz-input>
                        </div>
                    </div>
                    <div *ngIf="positionName.errors?.required && positionName.touched"  nz-col [nzSpan]="6" [nzOffset]="3"     class="fromErrors">
                        请必须输入岗位名称
                    </div>
                </div>
                <div nz-col [nzSpan]="24" class="mb-md">
                    <div nz-form-item class="d-flex">
                        <div nz-col [nzSpan]="3"   nz-form-label class="alignment"><label for="funcCode">岗位代码</label><span [ngClass]="{'fromErrors':positionName.errors?.required}">* </span></div>
                        <div nz-col [nzSpan]="20" nz-form-control>
                            <nz-input [(ngModel)]="postAdd.positionCode"
                                      name="positionCode" #positionCode="ngModel"  required [nzSize]="'large'"
                                      [nzPlaceHolder]="'岗位代码'"
                                      (nzBlur)="AppCodeexit(postAddEdit, postAdd.positionCode)"
                                      nzId="positionCode"></nz-input>
                            <nz-alert *ngIf='isappcodeSlash' nzBanner nzMessage="已存在相同的岗位代码，请重新输入"></nz-alert>
                        </div>
                    </div>
                    <div *ngIf="positionCode.errors?.required && positionCode.touched"  nz-col [nzSpan]="6" [nzOffset]="3"     class="fromErrors">
                        请必须输入岗位代码
                    </div>
                </div>

                <div nz-col [nzSpan]="24" class="mb-md" *ngIf="this.isEdit">
                    <div nz-form-item class="d-flex">
                        <div nz-col [nzSpan]="3"   nz-form-label class="alignment"><label for="funcCode">岗位类型</label></div>
                        <div nz-col [nzSpan]="20" nz-form-control>
                            <nz-select style="width:100%" [(ngModel)]="postAdd.positionType"  nzAllowClear disabled  name="positionType" [nzSize]="'large'" [nzPlaceHolder]="'岗位类型'" nzId="positionType">
                                <nz-option   *ngFor="let i of positionType;" [nzLabel]="i.itemName" [nzValue]="i.itemValue">></nz-option>
                            </nz-select>
                        </div>
                    </div>
                </div>

                <div nz-col [nzSpan]="24" class="mb-md" *ngIf="this.isEdit">
                    <div nz-form-item class="d-flex">
                        <div nz-col [nzSpan]="3"   nz-form-label class="alignment"><label for="funcCode">岗位状态</label></div>
                        <div nz-col [nzSpan]="20" nz-form-control>
                            <nz-select style="width:100%" [(ngModel)]="postAdd.positionStatus"  nzAllowClear disabled name="positionStatus" [nzSize]="'large'" [nzPlaceHolder]="'岗位状态'" nzId="positionStatus">
                                <nz-option  *ngFor="let i of postStatus;" [nzLabel]="i.itemName" [nzValue]="i.itemValue">></nz-option>
                            </nz-select>
                        </div>
                    </div>
                </div>
                <div nz-col [nzSpan]="24" class="mb-md">
                    <div nz-form-item class="d-flex">
                        <div nz-col [nzSpan]="4" nz-form-label class="alignment"><label for="funcCode">所属岗位</label><nz-switch [(ngModel)]="parentPost" name="switch.parentPost" (ngModelChange)="switchchange('parentPost', parentPost)" nzCheckedChildren="开" nzUnCheckedChildren="关"></nz-switch></div>
                        <div nz-col [nzSpan]="12" nzOffset="0" nz-form-control *ngIf="parentPost">
                            <nz-select style="width:100%" [(ngModel)]="postAdd.guidParents" nzAllowClear name="guidParents"  [nzSize]="'large'" [nzPlaceHolder]="'所属岗位'" nzId="guidParents">
                                <nz-option  *ngFor="let i of Parentsguid;" [nzLabel]="i.positionName" [nzValue]="i.guid"></nz-option>
                            </nz-select>
                        </div>
                    </div>
                </div>
                <div nz-col [nzSpan]="24" class="mb-md">
                    <div nz-form-item class="d-flex">
                        <div nz-col [nzSpan]="4"   nz-form-label class="alignment"><label for="funcCode">岗位有效时间</label><nz-switch [(ngModel)]="startDate" name="switch.startDate"  (ngModelChange)="switchchange('startDate', startDate)" nzCheckedChildren="开" nzUnCheckedChildren="关"></nz-switch></div>
                        <div nz-col [nzSpan]="12" nzOffset="0" nz-form-control *ngIf="startDate">
                            <nz-datepicker [(ngModel)]="postAdd.startDate" name="startDate" [nzSize]="'large'" [nzPlaceHolder]="'岗位有效时间'" nzId="startDate" class="d-block"></nz-datepicker>
                        </div>
                    </div>
                </div>
                <div nz-col [nzSpan]="24" class="mb-md">
                    <div nz-form-item class="d-flex">
                        <div nz-col [nzSpan]="4"   nz-form-label class="alignment"><label for="funcCode">岗位失效时间</label><nz-switch [(ngModel)]="endDate"  name="switch.endDate" (ngModelChange)="switchchange('endDate', endDate)" nzCheckedChildren="开" nzUnCheckedChildren="关"></nz-switch></div>
                        <div nz-col [nzSpan]="12" nzOffset="0" nz-form-control *ngIf="endDate">
                            <nz-datepicker [(ngModel)]="postAdd.endDate" name="endDate" [nzSize]="'large'" [nzPlaceHolder]="'岗位失效时间'" nzId="endDate" class="d-block"></nz-datepicker>
                        </div>
                    </div>
                </div>
            </div>
            <div nz-row>
                <div nz-col [nzSpan]="6" [nzOffset]="19">
                    <button style="margin-right: 16%" nz-button [nzType]="'default'" [nzSize]="'large'" (click)="modalVisible = false">
                        取 消
                    </button>
                    <button nz-button type="submit" [nzType]="'primary'" [nzSize]="'large'" [disabled]="f.invalid"  [nzLoading]="isConfirmLoading">
                        提 交
                    </button>
                </div>
            </div>
        </form>
    </ng-template>
    <ng-template #modalFooter></ng-template>
</nz-modal>


<!--在岗员工数-->
<nz-modal [nzVisible]="empdistribution" [nzMaskClosable]="false"  [nzWidth]="1024" [nzTitle]="postTitle"  [nzConfirmLoading]="loading" [nzContent]="modalempdistribution"
          (nzOnCancel)="empdistribution=false" (nzOnOk)="empsave()">
    <ng-template #modalempdistribution>
        <div *ngIf='modelSelect'>
            <div style="margin-top: 10px" nz-row  [nzType]="'flex'" [nzJustify]="'start'" [nzGutter]="24">
                <div  [nzOffset]="7"  nz-col [nzSpan]="12" class="mb-md">
                    <div  nz-form-item class="d-flex">
                        <div nz-form-label><label>选择员工</label></div>
                        <div nz-form-control class="flex-1">
                            <nz-select
                                style="width: 200px;"
                                nzAllowClear
                                [nzPlaceHolder]="'增加更多员工'"
                                [(ngModel)]="selectedOption"
                                nzShowSearch>
                                <nz-option
                                    *ngFor="let option of searchOptions"
                                    [nzLabel]="option.empName"
                                    [nzValue]="option.guid"
                                    [nzDisabled]="option.disabled">
                                </nz-option>
                            </nz-select>
                            <button style="margin-left: 1%;" (click)="addEmpClick()" nz-button type="submit" [nzType]="'primary'" [nzLoading]="loading" [nzSize]="'large'">添加员工</button>
                        </div>

                    </div>

                </div>
            </div>
            <app-list  [initDate]="empData"
                       [showAdd]="showAdd"
                       (addCreat)="addEmp($event)"
                       (buttonData)="buttonEmp($event)"
                       (pageNumber)="empHandler($event)"
                       (deleatData)="deleatEmp($event)"
                       (buttonEvent)="empEvent($event)"
                       (selectedRow)="selectedemp($event)"
                       [headerDate]="empDataheader"
                       [loading]="loading"
                       [moreData]="EmpData"
                       [total]="empTotal"></app-list>
        </div>

        <div *ngIf='!modelSelect'>
            <div style="margin-top: 10px" nz-row  [nzType]="'flex'" [nzJustify]="'start'" [nzGutter]="24">
                <div [nzOffset]="2" nz-col [nzSpan]="16" class="mb-md">
                    <div  nz-form-item class="d-flex">
                        <div nz-form-label><label>应用系统</label></div>
                        <div nz-form-control class="flex-1">
                            <nz-select style="width: 400px;" nzAllowClear
                                       [nzMode]="'multiple'"
                                       [nzPlaceHolder]="'增加更多可用应用'"
                                       [(ngModel)]="selectedMultipleOption"
                                       [nzNotFoundContent]="'无法找到'"
                                       nzShowSearch>
                                <nz-option
                                    *ngFor="let option of searchOptions"
                                    [nzLabel]="option.appName"
                                    [nzValue]="option.guid"
                                    [nzDisabled]="option.disabled">
                                </nz-option>
                            </nz-select>
                            <button style="margin-left: 1%;" *appIf="appcofList.funcObject.group.grouppostApp" (click)="appClick()" nz-button type="submit" [nzType]="'primary'" [nzLoading]="loading" [nzSize]="'large'">确定</button>
                        </div>
                    </div>
                </div>
            </div>
            <!-- 监听列表组件，如果点击了则告诉弹出框组件，打开弹出框,监听addCreat方法-->
            <app-list  [showAdd]="showAdd"
                       [configTitle]="appConfit"
                      (addCreat)="addappHandler($event)"
                      (buttonData)="buttonappDataHandler($event)"
                      (pageNumber)="monitorappHandler($event)"
                      (selectedRow)="selectedappRow($event)"
                      (deleteBatch)="deleteBatchApp($event)"
                      [initDate] = "appData"
                      (buttonEvent) = "appDel($event)"
                      [total]="Apptotal"
                       [loading]="loading"
                      [headerDate] = "AppheaderData"
                      [moreData] = "moreData"></app-list>
        </div>

    </ng-template>
</nz-modal>
















